home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: H&S <=> K&R
- Date: 08 Mar 1996 01:10:23 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar7181023@qcd.lanl.gov>
- References: <4hnjgp$brj@cisunix1.dfci.harvard.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: gotd@jimmy.harvard.edu's message of 7 Mar 1996 21:12:57 GMT
-
- In article <4hnjgp$brj@cisunix1.dfci.harvard.edu>
- gotd@jimmy.harvard.edu (Godfrey Degamo) writes:
-
- GD: First, my H&S 4th edition mentions nothing (I think) on
- GD: fflush with argument NULL. However, my ANSI K&R book clearly states
- GD: that fflush( NULL) flushes all output stream. My K&R book is
- GD: copyright 1988, my H&S book is copyright 1995. So, has this
- GD: feature of ANSI C changed? (Or am I just overlooking something?)
-
- Yes, in ANSI, fflush(NULL) flushes all streams on which the action of
- fflush is defined.
-
- GD: Second, my K&R book clearly states that the scanf conversions,
- GD: [...], and [^...] matches a *non-empty* string. Whereas my H&S book
- GD: does not. (I don't think it implies it... but I'm not sure...)
-
- An empty string results in a match failure.
-
- GD:
- GD: Thus according to K&R the following will happen?
- GD: char buf1[] = "blahblah:123212";
- GD: char buf2[] = ":2313";
- GD:
- GD:
- GD: sscanf( buf1, "%[^:]:%s", s1, s2); /* OK in K&R and H&S */
- GD: sscanf( buf2, "%[^:]:%s", s1, s2); /* Error in K&R, but H&S?????? */
-
- Not an error: you just get a return value of 0. s1 and s2 do not
- change.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-